
<%inherit file="base.mako" />
<script type="text/javascript">
var test = 0;
function appendPage(url,id) {
    //Insert the html returned from URL in the span with id 'id'
    var xmlhttp;
    if (window.XMLHttpRequest) {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    } else {
    // code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function() {
        if(xmlhttp.readyState==4) {
            
            document.getElementById(id+test).innerHTML+=xmlhttp.responseText+"<div id='"+id+(test+1)+"></div>";
            test++;
        }
    }
    xmlhttp.open("GET",url+"?number="+test,true);
    xmlhttp.send(null);
}


function getPage(url,id) {
    //Insert the html returned from URL in the span with id 'id'
    var xmlhttp;
    if (window.XMLHttpRequest) {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    } else {
    // code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function() {
        if(xmlhttp.readyState==4) {
            document.getElementById(id).innerHTML=xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
}

function newClient() {
    document.getElementById("space").innerHTML = "<input type=button value='Nuevo Individuo' onclick=getPage('/tables_admin/new/client_data?rend=False','space')><input type=button value='Nueva Empresa' onclick=getPage('/tables_admin/new/company?basichtml=True','space')>"
}

function setInnerHtml(id,str) {
    document.getElementById(id).innerHTML=str
}

function filter(f,url,id) {
  getPage(url+"?name="+f.name.value+"&personal_id="+f.personal_id.value+"&telephone="+f.telephone.value,id)
//  alert(url+"?name="+f.name.value+"&personal_id="+f.personal_id.value+"&telephone="+f.telephone.value);
}

</script>
TEMP:<br>
<a href="http://localhost/serve_client/main?client_id=1&readonly=True">Cliente Gallo</a><br>
<a href="http://localhost/tables_admin/new/contract?Contract--account_id=1&Contract--agent_id=1&account_id=1&Contract--start_date__month=1&Contract--start_date__day=2&Contract--start_date__year=2000&Contract--end_date__month=2&Contract--end_date__day=1&Contract--end_date__year=2020&Line-0-number=777&Line-0-product_id=123&Line-0-plan_id=1&0-Plan-1-services-1=1&Line-1-number=666&Line-1-product_id=124&Line-1-plan_id=2&submit=Crear">Crear contrato con 2 lineas</a>
<form name="myForm">
<input type=button name=nombre value='Cliente Nuevo' onclick="newClient()">
<input type=button name=nombre value='Buscar Cliente' onclick="getPage('/serve_client/search','space');">
</form>
<br><br><br>
<div id="space">
</div>


